﻿using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations.Schema;

namespace CRM.Models
{
    [Table("customer_group")]
    [Index(nameof(CompanyId), Name = "CompanyId")]
    [Index(nameof(OemId), Name = "OemId")]
    [Index(nameof(UserId), Name = "UserId")]
    public class CustomerGroup : BaseModel
    {

        public int Id { get; set; }

        [Column(TypeName = "varchar(50)")]
        public string Name { get; set; }
        public int OemId { get; set; }

        public int CompanyId { get; set; }
        public int GroupId { get; set; }

        public int UserId { get; set; }
        #nullable enable
        public User? User { get; set; }
        #nullable restore
        [JsonIgnore,NotMapped]
        public virtual Collection<Customer> Customers { get; set; }
    }
}
